import {InterpolateLinear} from '../../constants.js'
import {KeyframeTrack} from '../KeyframeTrack.js'
import {QuaternionLinearInterpolant} from '../../math/interpolants/QuaternionLinearInterpolant.js'

/**
 * A Track of quaternion keyframe values.
 */

function QuaternionKeyframeTrack(name, times, values, interpolation) {
  KeyframeTrack.call(this, name, times, values, interpolation)
}

QuaternionKeyframeTrack.prototype = Object.assign(Object.create(KeyframeTrack.prototype), {
  constructor: QuaternionKeyframeTrack,

  ValueTypeName: 'quaternion',

  // ValueBufferType is inherited

  DefaultInterpolation: InterpolateLinear,

  InterpolantFactoryMethodLinear: function (result) {
    return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result)
  },

  InterpolantFactoryMethodSmooth: undefined, // not yet implemented
})

export {QuaternionKeyframeTrack}
